﻿using Coldairarrow.Business.FP;
using Coldairarrow.Entity.DTO;
using Coldairarrow.Entity.FP;
using Coldairarrow.IBusiness.DTO;
using Coldairarrow.Util;
using Microsoft.AspNetCore.Mvc;
using System.Collections.Generic;
using System.Threading.Tasks;

namespace Coldairarrow.Api.Controllers.FP
{
    [Route("/FP/[controller]/[action]")]
    public class Base_OverFlowLogController : BaseApiController
    {
        #region DI

        public Base_OverFlowLogController(IBase_OverFlowLogBusiness base_OverFlowLogBus)
        {
            _base_OverFlowLogBus = base_OverFlowLogBus;
        }

        IBase_OverFlowLogBusiness _base_OverFlowLogBus { get; }

        #endregion

        #region 获取

        [HttpPost]
        public async Task<PageResult<Base_OverFlowLog>> GetDataList(PageInput<ConditionDTO> input)
        {
            return await _base_OverFlowLogBus.GetDataListAsync(input);
        }

        [HttpPost]
        public async Task<Base_OverFlowLog> GetTheData(IdInputDTO input)
        {
            return await _base_OverFlowLogBus.GetTheDataAsync(input.id);
        }

        #endregion

        #region 提交

        [HttpPost]
        public async Task SaveData(Base_OverFlowLog data)
        {
            if (data.Id.IsNullOrEmpty())
            {
                InitEntity(data);

                await _base_OverFlowLogBus.AddDataAsync(data);
            }
            else
            {
                await _base_OverFlowLogBus.UpdateDataAsync(data);
            }
        }

        [HttpPost]
        public async Task DeleteData(List<string> ids)
        {
            await _base_OverFlowLogBus.DeleteDataAsync(ids);
        }

        [HttpPost]
        [NoCheckJWT]
        public async Task<Base_OverFlowLoglist> GetOverFlowLoglist(string BillId, string OverFlowId, string Type) {
            var List = await _base_OverFlowLogBus.GetOverFlowLoglist(BillId, OverFlowId,Type);
            return List;
        }
        /// <summary>
        /// 获取审批历史
        /// </summary>
        /// <param name="input"></param>
        /// <returns></returns>
        [HttpPost]
        public async Task<PageResult<ApprovalTask>> GetApprovalTaskList(PageInput<ConditionDTO> input) {
            var res = await _base_OverFlowLogBus.GetApprovalTaskList(input);
            return res;
        }
        [HttpPost]
        public async Task<List<DingDesignListCC>> GetDingDesignListCC(string BillId, string BillType) {
            var listData = await _base_OverFlowLogBus.GetDingDesignListCC(BillId, BillType);
            return listData;
        }
        #endregion
    }
}